Skip to content

Fix QField Camera orientation by adding user-controlled rotation + persisted setting#7028

Open
kaustuvpokharel wants to merge 10 commits intomasterfrom
bug/cameraOrientation
Open

Fix QField Camera orientation by adding user-controlled rotation + persisted setting#7028
kaustuvpokharel wants to merge 10 commits intomasterfrom
bug/cameraOrientation

Conversation

@kaustuvpokharel
Copy link
Collaborator

@kaustuvpokharel kaustuvpokharel commented Feb 6, 2026

This PR tackles the inconsistent QtCamera photo orientation (auto-orientation / azimuth-related mismatch) by introducing a simple manual override that the user can set once and keep.

What changed

  1. QML: “Phone rotate” control
  • Adds a “Phone rotate” button that appears only on mobile and only when the device is not in portrait (landscape / rotated mode).
  • Lets users pick the correct orientation (and preview/try alternatives).
  • Persists the chosen rotation via Settings, so the app consistently applies the user’s preference on future captures.
  1. C++: rotate saved image for consistency
  • Applies the same selected rotation to the captured image file (pixels are rotated and orientation tags normalized) so that:

    • QML preview and external viewers match
    • EXIF orientation doesn’t cause double-rotation

Why

QtCamera / platform auto-orientation is unreliable across devices, and I can understand why qt cannot come with a rigid fix for this, as there are thousands of devices with different mechanism within it and for one universal fix. Persisting a user-selected rotation is a pragmatic fallback that prevents repeated wrong-orientation captures without forcing a single hardcoded behavior.

Issue related that could (perhaps) be fixed with this: #7005 #5820 #5224

Demo:

trim.DFE5F7DA-4005-484F-9953-545DF3ACAD8E.MOV

@kaustuvpokharel kaustuvpokharel force-pushed the bug/cameraOrientation branch 2 times, most recently from 769ce8a to 239edd6 Compare February 6, 2026 23:31
@kaustuvpokharel kaustuvpokharel changed the title Fix QtCamera orientation by adding user-controlled rotation + persisted setting Fix QField Camera orientation by adding user-controlled rotation + persisted setting Feb 6, 2026
@qfield-fairy
Copy link
Collaborator

qfield-fairy commented Feb 6, 2026

🍎 MacOS DMG universal builds

Download a MacOS DMG universal build of this PR for testing.
(Built from commit 3cdc92d)

📱 Android builds

Download an Android arm64 build of this PR for testing.
(Built from commit 3cdc92d)

Other Android architectures

🪟 Windows builds

Download a Windows build of this PR for testing.
(Built from commit 3cdc92d)

🐧 Linux AppImage builds

Download a Linux AppImage build of this PR for testing.
(Built from commit 3cdc92d)

@kaustuvpokharel kaustuvpokharel self-assigned this Feb 7, 2026
@nirvn
Copy link
Member

nirvn commented Feb 8, 2026

@kaustuvpokharel , nice one -- can you rebase?

Copy link
Collaborator

@mohsenD98 mohsenD98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @kaustuvpokharel 👍 , just 2 comment

@mohsenD98
Copy link
Collaborator

and these 2 icons are so similar, specially in small screens:
Image

@nirvn nirvn closed this Mar 9, 2026
@nirvn nirvn reopened this Mar 9, 2026
Copy link
Collaborator

@mohsenD98 mohsenD98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay just tested the APK, image capture rotation works fine for me. good job @kaustuvpokharel 👍

--

Suggestion about video capture: Hide/disable the rotation button during VideoCapture state and add a comment that video rotation is a follow-up

--

below some comments

Copy link
Collaborator

@mohsenD98 mohsenD98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work addressing the feedback! @kaustuvpokharel 👍

@nirvn
Copy link
Member

nirvn commented Mar 16, 2026

Do not merge this yet, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants